package mobi.greenplate.theweb.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import mobi.greenplate.theweb.domain.UserDetail;


@XmlRootElement(name="userDetail-list")
public class UserDetailListConverter {

    private final List<UserDetail> entities;

    public UserDetailListConverter() {
        this.entities=new ArrayList<UserDetail>();
    }
    
    public UserDetailListConverter(List<UserDetail> entities) {
        this.entities = entities;
    }

    @XmlElement
    public List<UserDetailConverter> getUserDetail(){
        final List<UserDetailConverter> list = new ArrayList<UserDetailConverter>();
        for (UserDetail userDetail : entities) {
            list.add(new UserDetailConverter(userDetail));
        }
        return list;
    }

    @XmlTransient
    public List<UserDetail> getEntities(){
        return Collections.unmodifiableList(this.entities);
    }

}


